# include <stdio.h>
# include <math.h>

int main(void) {
    char op;
    double x, y, result;
    int error = 0;
    printf("Enter an expression: ");
    scanf("%lf %c %lf", &x, &op, &y);
    switch (op) {
        case '+':
            result = x + y;
            break;
        case '-':
            result = x - y;
            break;
        case '*':
            result = x * y;
            break;
        case '/':
            if (fabs(y) > 1e-10)
                result = x / y;
            else
                error = 1;
            break;
        default:
            error = 1;
    }
    //如果输入的表达式是正确的，则输出结果
    if (error == 0) {
        printf("%.2f %c %.2f = %.2f\n", x, op, y, result);
    } else {
        printf("Wrong input\n");
    }

}
